﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CanvasEx.DrawCore
{
    class DrawLine : DrawObject
    {
        Point sta, end;
        LineGeometry line;


        public DrawLine(Painter p, Point sta, Point end)
            : base(p)
        {
            this.sta = sta;
            this.end = end; 
            line = new LineGeometry(sta, end);
            path.Data = line;
        }

        public override Geometry GetGeometry()
        {
            return line;
        }
        public override bool InGraph(Point Location, double SelectAccuracy)
        {
            if (DrawHelper.Getdistance(Location, sta) + DrawHelper.Getdistance(Location, end) -
                DrawHelper.Getdistance(sta, end) > SelectAccuracy / 5)
                return false;
            else
                return true;
        }

        public override List<Point> GetHotSpot()
        {
            return new List<Point>() { sta, end };
        }
    }
}
